import { a as i } from "./cookie.6dbf4ab5.js";
import { a as s } from "./axios.9c3092fd.js";
function a({ code: t, VUE_APP_BASE_API: r, token: o }) {
  return s({
    url: r + "/dictionary/getvaluelistbydiscode",
    method: "get",
    headers: {
      Authorization: `Bearer ${o}`
    },
    params: { code: t }
  }).then((e) => e.data);
}
function u(t) {
  try {
    return JSON.parse(t);
  } catch (r) {
    return console.error(r), null;
  }
}
const l = function(t) {
  if (!t)
    return null;
  var r = `dic.${t}`, o = i.get(r);
  return o && sessionStorage.getItem(r) ? Promise.resolve(u(sessionStorage.getItem(r))) : a(t).then((e) => e.data).then((e) => e ? e && e.length <= 0 ? Promise.resolve([]) : (e = e.map((n) => ({
    label: n.name,
    value: n.code + ""
  })), i.set(r, 1, { expires: 0.5 / 24 }), sessionStorage.setItem(r, JSON.stringify(e)), Promise.resolve(e)) : Promise.resolve([]));
};
function f(t = [], r) {
  var o = t.filter((e) => e.value == r);
  if (o && o[0])
    return o[0].label;
}
function c(t = [], r) {
  var o = t.filter((e) => e.value == r);
  if (o && o[0])
    return o[0];
}
const v = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  ajaxDicList: l,
  getLabelText: f,
  getLabelOne: c
}, Symbol.toStringTag, { value: "Module" }));
export {
  v as d
};
